---
layout: "default"
title: "readLine"
description: "Swift documentation for 'readLine': Returns a string read from standard input through the end of the current."
keywords: "readLine,func,swift,documentation"
root: "/v3.0"
---

<div class="declaration" id="func-readline_-bool">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-readline_-bool">func readLine(<wbr>_: Bool)</a>
        
<div class="comment collapse" id="comment-func-readline_-bool"><div class="p">
    <p>Returns a string read from standard input through the end of the current
line or until EOF is reached.</p>

<p>Standard input is interpreted as <code>UTF-8</code>. Invalid bytes are replaced by
Unicode <a href="http://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character">replacement characters</a>.</p>

<p><strong><code>strippingNewline</code>:</strong>  If <code>true</code>, newline characters and character
  combinations are stripped from the result; otherwise, newline characters
  or character combinations are preserved. The default is <code>true</code>.
<strong>Returns:</strong> The string of characters read from standard input. If EOF has
  already been reached when <code>readLine()</code> is called, the result is <code>nil</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func readLine(strippingNewline: Bool = default) -&gt; String?</code>
    
    
</div></div>
</div>
